//
//  Const.h
//  FoxitApp
//
//  Created by Christine on 11/24/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#ifndef FoxitApp_Const_h
#define FoxitApp_Const_h

//App database version:
//1. The first release.
//2. Support cloud.

//12.  reader 老版本升级到新版本 将版本升级到12  此处应当注意appstore线上的数据库版本
#define CURRENT_DB_VERSION 12

//Recent file count in file list.
#define RECENT_FILE_COUNT 100

/** 授权相关定义 */
#define FXKP_MRSDK_SN @"FXKP_MRSDK_SN"
#define FXKP_MRSDK_IP @"FXKP_MRSDK_IP"

//Define the internal used paths
#define MRSDK_DOCUMENT_MAIN_STRING @"fxMRDK"

#define DOCUMENT_PATH [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
#define LIBRARY_PATH [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]
#define OLD_CACHE_PATH [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"PDFCache"]
#define DOCUMENT_INBOX_PATH [DOCUMENT_PATH stringByAppendingPathComponent:@"Inbox"]// Inbox目录是接收文件的，iOS系统把分享过来的文件复制一份到Inbox目录下
#define MRSDK_DOCUMENT_PATH [DOCUMENT_PATH stringByAppendingPathComponent:@"fxMRDK"]// mrsdk主目录
#define MRSDK_FILE_PATH [MRSDK_DOCUMENT_PATH stringByAppendingPathComponent:@"Document"]// 文档主目录
#define MRSDK_DOCUMENT_Sign_PATH [MRSDK_DOCUMENT_PATH stringByAppendingPathComponent:@"sign"]// 签名图片生成路径
#define MRSDK_DOCUMENT_Stamp_PATH [MRSDK_DOCUMENT_PATH stringByAppendingPathComponent:@"stamp"]
#define CACHES_PATH [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]
#define MRSDK_CACHES_PATH [CACHES_PATH stringByAppendingPathComponent:@"fxMRDK"]
#define MRSDK_DOCUMENT_Font_PATH [MRSDK_DOCUMENT_PATH stringByAppendingPathComponent:@"font"]// 字体存放路径
#define MRSDK_DOCUMENT_attachmentIcon_PATH [MRSDK_DOCUMENT_PATH stringByAppendingPathComponent:@"attachmentIcon"]// svgicon
#define MRSDK_DOCUMENT_Html_PATH [MRSDK_DOCUMENT_PATH stringByAppendingPathComponent:@"html"]// html转换路径
#define MRSDK_DOCUMENT_Licence_PATH [MRSDK_DOCUMENT_PATH stringByAppendingPathComponent:@"Licence"]// 授权文件位置

#define MRSDK_DOCUMENT_Licence_Name @"fsmrkey.txt"// 授权文件名称

/// 缩略图缓存路径
#define MRSDK_FILE_THUMAIL_PATH [CACHES_PATH stringByAppendingPathComponent:@"FileThumailCache"]

//Define the internal used paths
#define TEMP_PATH NSTemporaryDirectory()
#define DATA_FOLDER_NAME @"Data"
#define INTERNAL_FOLDER_NAME @"Internal"
#define SIGNATURE_FOLDER_NAME @"Signature"
#define SHAREREVIEW_FOLDER_NAME @"Sharereview"
#define LOCALSYNCDATA_FOLDER_NAME @"LocalSyncData"
#define LASTSYNCDATA_FOLDER_NAME @"LastSyncData"
#define DRAFTDATA_FOLDER_NAME @"DraftSyncData"
#define TEMPFDF_FOLDER_NAME @"TempFDF"
#define COLLABSYNCDATA_FILE_NAME @"CollabSyncData.xml"
#define SAVEAS_FOLDER_NAME @"SaveAs"
#define PPDFTEMP_FOLDER_NAME @"ppdfTemp"
#define FOXIT_CLOUD_FOLDER_NAME @"FoxitCloud"
#define DATA_PATH [LIBRARY_PATH stringByAppendingPathComponent:DATA_FOLDER_NAME]
#define INTERNAL_PATH [DATA_PATH stringByAppendingPathComponent:INTERNAL_FOLDER_NAME]
#define SIGNATURE_PATH [DATA_PATH stringByAppendingPathComponent:SIGNATURE_FOLDER_NAME]
#define SHAREREVIEW_PATH [DATA_PATH stringByAppendingPathComponent:SHAREREVIEW_FOLDER_NAME]
#define CACHE_PATH [DATA_PATH stringByAppendingPathComponent:@"PDFCache"]
#define LOCALSYNCDATA_PATH [SHAREREVIEW_PATH stringByAppendingPathComponent:LOCALSYNCDATA_FOLDER_NAME]
#define LASTSYNCDATA_PATH [SHAREREVIEW_PATH stringByAppendingPathComponent:LASTSYNCDATA_FOLDER_NAME]
#define COLLABSYNCDATA_PATH [SHAREREVIEW_PATH stringByAppendingPathComponent:COLLABSYNCDATA_FILE_NAME]
#define DRAFTSYNCDATA_PATH [SHAREREVIEW_PATH stringByAppendingPathComponent:DRAFTDATA_FOLDER_NAME]
#define TEMPFDF_PATH [SHAREREVIEW_PATH stringByAppendingPathComponent:TEMPFDF_FOLDER_NAME]
#define PPDFTEMP_PATH [INTERNAL_PATH stringByAppendingPathComponent:PPDFTEMP_FOLDER_NAME]
#define FOXIT_CLOUD_PATH [DATA_PATH stringByAppendingPathComponent:FOXIT_CLOUD_FOLDER_NAME]
#define THUMBNAIL_FOLDER_NAME @"Thumbnail"
#define CREATE_PDF_FOLDER_NAME @"CreatePDF"
#define STREAM_CACHES_FOLDER_NAME @"StreamCaches"
#define STREAM_CACHES_PATH [FOXIT_CLOUD_PATH stringByAppendingPathComponent:STREAM_CACHES_FOLDER_NAME]
#define CREATE_PDF_PATH [TEMP_PATH stringByAppendingPathComponent:CREATE_PDF_FOLDER_NAME]
#define CLOUD_MARK @".CloudFolder"




//Guide file
#define GUIDE_FILE_NAME @"Quick Starter Guide.pdf"
#define GUIDE_FILE_NAME2 @"Quick Start Guide.pdf"
#define GUIDE_FILE_IPAD_NAME @"Quick Start Guide iPad.pdf"
#define GUIDE_FILE_IPHONE_NAME @"Quick Start Guide iPhone.pdf"
#define GUIDE_FILE_VERSION 18
#ifdef RMS
#define GUIDE_FILE_WHATISNEW_NAME @"What's New in V4.8.pdf"
#else 
#define GUIDE_FILE_WHATISNEW_NAME @"What's New in V4.8.pdf"
#endif
#define GUIDE_FILE_WHATISNEW_VERSION 13


//Define thumbnail/overview image size
//old Width = 58.0
#define THUMBNAIL_IMAGE_WIDTH 58.0
#define THUMBNAIL_IMAGR_HEIGHT 58.0
#define THUMBNAIL_IMAGE_WIDTH_EX 84.0
#define THUMBNAIL_IMAGE_HEIGHT_EX 87.0
#define THUMBNAIL_IMAGE_WIDTH_LARGE_EX 128.0
#define THUMBNAIL_IMAGE_HEIGHT_LARGE_EX 134.0f
#define FILE_IMAGE_WIDTH 50.0
#define FILE_IMAGE_HEIGHT 54.0
#define OVERVIEW_IMAGE_WIDTH 160.0
#define OVERVIEW_IMAGE_HEIGHT 200.0
#define OVERVIEW_IMAGE_WIDTH_IPHONE 142.0
#define OVERVIEW_IMAGE_HEIGHT_IPHONE 177.0

//Maths
#define PI 3.1415926

//AES_KEY
#define AES_KEY @"863GreeXSi_&^"
/** Whether it is iphone. */
#define DEVICE_iPHONE ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
#define SIZECLASS [UIApplication sharedApplication].keyWindow.traitCollection.horizontalSizeClass

//iOS version
#define OS_VERSION [NSString stringWithFormat:@"%@", [[UIDevice currentDevice] systemVersion]]
#define OS_ISVERSION5 (BOOL)(OS_VERSION.integerValue >= 5)
#define OS_ISVERSION6 (BOOL)(OS_VERSION.integerValue >= 6)
#define OS_ISVERSION7 (BOOL)(OS_VERSION.integerValue >= 7)
#define OS_ISVERSION8 (BOOL)(OS_VERSION.integerValue >= 8)
#define OS_ISVERSION9 (BOOL)(OS_VERSION.integerValue >= 9)

#define PDF_PREVIEW_MAX_SIZE (DEVICE_iPHONE?1000 * 1000:1500 * 1500)
#define APPLICATION_ISFULLSCREEN [UIApplication sharedApplication].statusBarHidden

////AppDelegate
//
//#define APPDELEGATE  ([FXAppDelegate getSharedAppDelegate])

/// FXRSDKDelegate
#define FXRSDKDELEGATE  ([FXRSDKDelegate shareInstance])

//Screen frame
#define SCREENWIDTH  [UIScreen mainScreen].bounds.size.width
#define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height
#define SCREEN_MIN MIN(SCREENHEIGHT,SCREENWIDTH)
#define SCREEN_MAX MAX(SCREENHEIGHT,SCREENWIDTH)
/** Shorter side of main screen. */
#define STYLE_CELLWIDTH_IPHONE ([UIScreen mainScreen].bounds.size.width < [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.width : [UIScreen mainScreen].bounds.size.height)
/** longer side of main screen. */
#define STYLE_CELLHEIHGT_IPHONE ([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.width : [UIScreen mainScreen].bounds.size.height)

#define kUIPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define kIphoneX (kUIPhone && (MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) > 736))

#define kStatusBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height == 0?(kIphoneX?44:20):[[UIApplication sharedApplication] statusBarFrame].size.height)
#define kIS_IPHONE_X (kStatusBarHeight >= 44.0f)
#define kNavigationBarNormalHeight (44)
#define kNavigationBarHeight (kNavigationBarNormalHeight + kStatusBarHeight)
#define kBottomSafeAreaHeight (kIphoneX?34:0)
#define kTabBarNormalHeight (49)
#define kTabBarHeight (kTabBarNormalHeight+kBottomSafeAreaHeight)

#ifdef DEBUG
#define FoxitLog(FORMAT, ...) printf("%s\n 第%d行 \n %s\n", __FUNCTION__, __LINE__,[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
# define FoxitLog(...)
#endif




#if DEBUG
#define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
#define NSLog(...) FoxitLog(@"%s 第%d行: %s\n", [LRString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String])
#endif


#define kBundlePath [[NSBundle mainBundle] pathForResource:@"FxkpMRSDKUIExtensions" ofType:@"framework" inDirectory:@"Frameworks"]

#define kMainBundleVersion @"kMainBundleVersion"

#define kGetImage(name) [UIImage imageNamed:name inBundle:[NSBundle bundleWithPath:kBundlePath] compatibleWithTraitCollection:nil]

#define kGetThemeImage(name) [UIImage imageNamed:[[FxThemeManager shareInstance] themeImageName:name] inBundle:[NSBundle bundleWithPath:kBundlePath] compatibleWithTraitCollection:nil]

#define kWeakSelf(weakSelf)  __weak __typeof(&*self) weakSelf = self;

#define FXUSER_DEFAULT [NSUserDefaults standardUserDefaults]

/// 获取rdk中的资源
#define kRDKBundlePath [[NSBundle mainBundle] pathForResource:@"FxkpMRSDK" ofType:@"framework" inDirectory:@"Frameworks"]
#define kRDKGetImage(name) [UIImage imageNamed:name inBundle:[NSBundle bundleWithPath:kRDKBundlePath] compatibleWithTraitCollection:nil]


#endif
